﻿using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Web;
namespace Chat.Common
{
    /// <summary>
    /// 处理的返回状态信息
    /// </summary>
    [Serializable]
    public class ResultStatus
    {
        /// <summary>
        /// 处理是否成功
        /// </summary>
        public bool Success
        {
            get;
            set;
        }

        /// <summary>
        /// 返回的消息
        /// </summary>
        public string Message
        {
            get;
            set;
        }

        /// <summary>
        /// 结果类型
        /// </summary>
        public ResultType Type
        {
            get;
            set;
        }

        /// <summary>
        /// 返回的异常信息
        /// </summary>
        public Exception Exception
        {
            get;
            set;
        }

        /// <summary>
        /// 返回的数据
        /// </summary>
        public string Data
        {
            get;
            set;
        }

        public ResultStatus(ResultType type)
        {
            this.Type = type;
            this.Success = true;
        }

        /// <summary>
        /// 将此实例生成JSON格式
        /// </summary>
        /// <returns></returns>
        public override string ToString()
        {
            return  Base64.Encode(JSON.EncodeObject(this));
        }
    }
}